package com.lzc.service.impl;

import cn.hutool.core.util.StrUtil;
import com.lzc.mapper.ErrorKeyMapper;
import com.lzc.pojo.entity.ErrorKey;
import com.lzc.pojo.vo.Result;
import com.lzc.service.ErrorKeyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ErrorKeyServiceImpl implements ErrorKeyService {

    @Autowired
    private ErrorKeyMapper errorKeyMapper;

    /**
     * 插入违禁词
     * @param text 违禁词
     * @return 200
     */
    @Override
    public Result insertKey(String text) {
        if (StrUtil.isBlank(text)){
            return Result.FILE("设置失败！！");
        }
        ErrorKey errorKey = new ErrorKey();
        errorKey.setText(text);
        errorKeyMapper.insert(errorKey);
        return Result.OK(null);
    }
}
